﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="~/resources/StyleSheet.css" rel="stylesheet" />
    <script src="~/resources/jquery-1.11.1.min.js"></script>
</head>
<body>
    <form id="form1">
        <div style="width:100%; height:100%; text-align:center; vertical-align:middle;">
            <div>
                <table cellpadding="0" cellspacing="0" border="0" style="margin:0 auto; width:300px; border:1px solid #196de8; margin-top:200px;background:#4e94fc;">
                    <tr>
                        <td style="height:30px;background:#4e94fc; text-align:left; padding-left:8px; color:#ffffff;" colspan="2">RoadFlowCore集成登录</td>
                    </tr>
                    <tr>
                        <td style="height:45px; background:#ffffff; width:80px; text-align:right;">账号：</td>
                        <td style="background:#ffffff; text-align:left;"><input type="text" id="account" name="account" /></td>
                    </tr>
                    <tr>
                        <td style="height:45px; background:#ffffff; text-align:right;">密码：</td>
                        <td style="background:#ffffff; text-align:left;"><input type="password" id="password" name="password" /></td>
                    </tr>
                    <tr>
                        <td style="background:#ffffff;height:35px;"></td>
                        <td style="text-align:left; background:#ffffff;">
                            <input type="button" value="登录" onclick="login(this);" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
    <script>
    function login(but) {
        var f = document.forms[0];
        var o = serializeForm($(f));
        $.ajax({url:"CheckLogin",data:o, type:"post",success:function (text) {
            if('1'==text){
                window.location = "index";
            } else {
                alert(text);
            }
            $(but).prop("disabled",false);

        }});

    }
    function serializeForm($form) {
        var o = {};
        var a = $form.serializeArray();
        $.each(a, function () {
            if (o[this.name] !== undefined) {
                if (!o[this.name].push) {
                    o[this.name] = [o[this.name]];
                }
                o[this.name].push(this.value || '');
            } else {
                o[this.name] = this.value || '';
            }
        });
        return o;
    }
    </script>
</body>
</html>
